<?php
/**************************************************************************************************
|
| AudioShare - Audio Sharing Script
| http://www.audiosharescript.com
| webmaster@audiosharescript.com
|
|**************************************************************************************************
|
| By using this software you agree that you have read and acknowledged our End-User License 
| Agreement available at http://www.audiosharescript.com/eula.html and to be bound by it.
|
| Copyright (c) 2010 AudioShareScript.com. All rights reserved.
|**************************************************************************************************/

include("include/config.php");
include("include/functions/import.php");
$thebaseurl = $config['baseurl'];

$mainmenu = "7";
STemplate::assign('mainmenu',$mainmenu);
$submenu = "9";
STemplate::assign('submenu',$submenu);

if (isset($_REQUEST[username]))
{
	$pid = $_REQUEST[username];
}
else
{
	$error = "$lang[582]";
}

if ($error == "")
{
	if (does_profile_exist($pid))
	{
		$query = "SELECT * FROM members WHERE username='".mysql_real_escape_string($pid)."'";
       	$executequery = $conn->execute($query);
       	$profilearray = $executequery->getarray();
		STemplate::assign('profilearray',$profilearray);
		
		if(mysql_affected_rows()>=1)
		{
			$USERID = $profilearray[0][USERID];
			STemplate::assign('USERID',$USERID);
			
			STemplate::assign('pagetitle',$profilearray[0][username]."'s $lang[796]");
			
			$query = "select * from audios where USERID='$USERID' AND public='1' AND active='1' order by AUDIOID desc"; 
			$results = $conn->execute($query);
			$listprofileaudios = $results->getrows();
			STemplate::assign('listprofileaudios',$listprofileaudios);
			$listprofileaudioscount = count($listprofileaudios);
			STemplate::assign('listprofileaudioscount',$listprofileaudioscount);
		
			$showtheme = "memberaudios.tpl";
		}
		else
		{
			$error = "$lang[583]";
		}
	}	
	else
	{
		$error = "$lang[584]";
	}
}


//TEMPLATES BEGIN
STemplate::assign('error',$error);
STemplate::assign('message',$message);

STemplate::display('header.tpl');
if ($error == "")
{
	STemplate::display($showtheme);
}
else
{
	STemplate::display('empty.tpl');
}
STemplate::display('footer.tpl');
//TEMPLATES END
?>